tests: Add outset shadow drawing test
authorTimm Bäder <mail@baedert.org>
Thu, 21 Dec 2017 16:57:16 +0000 (17:57 +0100)
committerTimm Bäder <mail@baedert.org>
Thu, 21 Dec 2017 18:12:33 +0000 (19:12 +0100)
tests/meson.build
tests/testoutsetshadowdrawing.c [new file with mode: 0644]

index decfb67be9819f4e1c84da38d251c6d2e12d45da..911e195511156ff687acc02593dcebc2c262354a 100644 (file)
@@ -128,6 +128,7 @@ gtk_tests = [
   ['testgridbaseline'],
   ['showrendernode'],
   ['testborderdrawing'],
+  ['testoutsetshadowdrawing'],
 ]
 
 if os_linux
diff --git a/tests/testoutsetshadowdrawing.c b/tests/testoutsetshadowdrawing.c
new file mode 100644 (file)
index 0000000..c158541
--- /dev/null
@@ -0,0 +1,157 @@
+
+#include<gtk/gtk.h>
+
+#define BOX_SHADOW "box-shadow: 10px 20px 5px 40px #0f0;"
+
+#define COLOR " #0f0;"
+/*#define COLOR " red;"*/
+
+static const char *css =
+".one {"
+"  all: unset;"
+"  min-width: 100px;"
+"  min-height:100px;"
+"  box-shadow: -10px -20px 5px 40px" COLOR
+"}"
+".two {"
+"  all: unset;"
+"  min-width: 100px;"
+"  min-height:100px;"
+"  box-shadow: -10px -20px 0px 40px" COLOR
+"}"
+".three {"
+"  all: unset;"
+"  min-width: 100px;"
+"  min-height:100px;"
+"  border-radius: 0px;"
+"  box-shadow: 0px 0px 10px 20px" COLOR
+"}"
+".four {"
+"  all: unset;"
+"  min-width: 100px;"
+"  min-height:100px;"
+"  box-shadow: 10px 20px 5px 40px" COLOR
+"  border-radius: 30px; "
+"margin-right: 50px;"
+"}"
+".five {"
+"  all: unset;"
+"  min-width: 100px;"
+"  min-height:100px;"
+"  border-radius: 30px; "
+"  box-shadow: 10px 20px 0px 40px" COLOR
+"}"
+#if 0
+".b1 {"
+"  all: unset;"
+"  min-width: 100px;"
+"  min-height:100px;"
+"  border-top: 30px solid black;"
+"  border-radius: 0px;"
+"}"
+".b2 {"
+"  all: unset;"
+"  min-width: 100px;"
+"  min-height:100px;"
+"  border-bottom: 30px solid black;"
+"  border-radius: 0px;"
+"}"
+".b3 {"
+"  all: unset;"
+"  min-width: 100px;"
+"  min-height:100px;"
+"  border-right: 30px solid blue;"
+"  border-radius: 40px;"
+"}"
+".b4 {"
+"  all: unset;"
+"  min-width: 100px;"
+"  min-height:100px;"
+"  border-bottom: 30px solid blue;"
+"  border-radius: 40px;"
+"}"
+#endif
+;
+
+
+int
+main (int argc, char **argv)
+{
+  GtkWidget *window;
+  GtkWidget *box;
+  GtkWidget *top;
+  GtkWidget *bottom;
+  GtkWidget *w;
+  GtkCssProvider *provider;
+
+  gtk_init ();
+
+  provider = gtk_css_provider_new ();
+  gtk_css_provider_load_from_data (provider, css, -1);
+  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
+                                              GTK_STYLE_PROVIDER (provider),
+                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 120);
+  top = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 120);
+  bottom = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 120);
+  g_object_set (box, "margin", 120, NULL);
+
+  w = gtk_button_new ();
+  gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
+  gtk_style_context_add_class (gtk_widget_get_style_context (w), "one");
+  gtk_container_add (GTK_CONTAINER (top), w);
+
+  w = gtk_button_new ();
+  gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
+  gtk_style_context_add_class (gtk_widget_get_style_context (w), "two");
+  gtk_container_add (GTK_CONTAINER (top), w);
+
+  w = gtk_button_new ();
+  gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
+  gtk_style_context_add_class (gtk_widget_get_style_context (w), "three");
+  gtk_container_add (GTK_CONTAINER (top), w);
+
+  w = gtk_button_new ();
+  gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
+  gtk_style_context_add_class (gtk_widget_get_style_context (w), "four");
+  gtk_container_add (GTK_CONTAINER (top), w);
+
+  w = gtk_button_new ();
+  gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
+  gtk_style_context_add_class (gtk_widget_get_style_context (w), "five");
+  gtk_container_add (GTK_CONTAINER (top), w);
+
+
+  /* Bottom */
+  /*w = gtk_button_new ();*/
+  /*gtk_widget_set_valign (w, GTK_ALIGN_CENTER);*/
+  /*gtk_style_context_add_class (gtk_widget_get_style_context (w), "b1");*/
+  /*gtk_container_add (GTK_CONTAINER (bottom), w);*/
+
+  /*w = gtk_button_new ();*/
+  /*gtk_widget_set_valign (w, GTK_ALIGN_CENTER);*/
+  /*gtk_style_context_add_class (gtk_widget_get_style_context (w), "b2");*/
+  /*gtk_container_add (GTK_CONTAINER (bottom), w);*/
+
+  /*w = gtk_button_new ();*/
+  /*gtk_widget_set_valign (w, GTK_ALIGN_CENTER);*/
+  /*gtk_style_context_add_class (gtk_widget_get_style_context (w), "b3");*/
+  /*gtk_container_add (GTK_CONTAINER (bottom), w);*/
+
+  /*w = gtk_button_new ();*/
+  /*gtk_widget_set_valign (w, GTK_ALIGN_CENTER);*/
+  /*gtk_style_context_add_class (gtk_widget_get_style_context (w), "b4");*/
+  /*gtk_container_add (GTK_CONTAINER (bottom), w);*/
+
+  gtk_container_add (GTK_CONTAINER (box), top);
+  gtk_container_add (GTK_CONTAINER (box), bottom);
+  gtk_container_add (GTK_CONTAINER (window), box);
+  g_signal_connect (window, "delete-event", gtk_main_quit, NULL);
+  gtk_widget_show (window);
+
+  gtk_main ();
+
+  gtk_widget_destroy (window);
+}